package com.xy.controller;

import com.xy.form.DocxContentForm;
import com.xy.service.IDocService;
import com.xy.utils.Response;
import com.xy.utils.ResponseFactory;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/doc")
@Tag(name = "word文档处理", description = "docxProcess")
public class DocxProcessController {

    private final IDocService iDocService;

    @Autowired
    public DocxProcessController(IDocService iDocService) {
        this.iDocService = iDocService;
    }

    @GetMapping("/readAndSaveLabels")
    public Response readAndSaveLabels(@RequestParam("typeId") Integer typeId) {
        return ResponseFactory.okResponse(iDocService.readAndSaveDocContent(typeId));
    }

    @PostMapping("/writeDocContent")
    public Response writeDocContent(@RequestBody DocxContentForm docxContentForm) {
        return ResponseFactory.okResponse(iDocService.writeDocContent(docxContentForm));
    }
}
